<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title><fmt:message key="historico"/></title>
    <link rel="stylesheet" media="all" href="css/estilos.css">
    <link rel="stylesheet" media="all" href="css/bootstrap.css">
    <script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
      
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-1.7.1.min.js"><\/script>')</script>
  </head>
  <body>
   <div id="image-logo">
     <c:import url="${pageScope.request.contextPath}/imports/fundo.jsp"/>
   </div>
   <div id="logo">
         <c:import url="${pageScope.request.contextPath}/imports/fundo2palha.jsp"/>
      </div>
  <div id="barra-titulo">
        <c:import url="${pageScope.request.contextPath}/imports/barraTituloSessaoUser.jsp"/> 
  </div>
  <div id="tabela-produtos-bazar">
		      <c:if test="${sucessoDeletar != null}">
		         <center>
		            <font class="sucesso"><fmt:message key="sucesso-deletar-venda"/> </font>
		         </center>
		      </c:if>
		      <c:if test="${erroDeletar != null}">
		         <center>
		            <font class="erro"><fmt:message key="erro-deletar-venda"/> </font>
		         </center>
		      </c:if>
		      <c:if test="${nenhumaVenda != null}">
		         <center>
		            <font class="vermelho"><fmt:message key="nenhuma-venda"/> </font>
		         </center>
		      </c:if>
		      <c:if test="${nenhumaCompra != null}">
		         <center>
		            <font class="vermelho"><fmt:message key="nenhuma-compra"/> </font>
		         </center>
		      </c:if>
		      <c:if test="${FalhaAtualizarStatus != null}">
		         <center>
		            <font class="vermelho"><fmt:message key="falha-atualizar-status"/> </font>
		         </center>
		      </c:if>
		      <c:if test="${erroBanco != null}">
		        <center>
		           <font class="erro"> <fmt:message key="erroBanco"/> </font>
		        </center>      
		      </c:if>
		      <table border="1" class="table table-striped table-hover">
		         <thead>  
		           <tr>
		              <th colspan="5">
		                <font class="vermelho">  <fmt:message key="${historicoCompras != null ? 'historico-compras' : 'historico-vendas'}"/> </font>
		              </th>
		           </tr>
		         <tr>
		            <th>
		                <fmt:message key="produto"/>
		            </th>
		             <th>
		                <fmt:message key="imagem"/>
		            </th>
		            <th>
		                <fmt:message key="preco"/>
		            </th>
		            <th colspan="3">
		                <fmt:message key="${historicoCompras != null ? 'vendedor' : 'comprador'}"/>
		            </th>
		         </tr>
		       </thead>
		          <tbody>
		            <c:forEach var="item" items="${historico}">
                       <tr>
                          <td>
                              ${item.nomeProduto}
                          </td>
                          <td>
		                     <img width="40px" height="30px" src="imagem?id=${item.idProduto}&tipo=compra">
		                  </td>
                          <td>
                              <fmt:formatNumber type="currency" value="${item.preco}"/>
                          </td>
                          <td>
                             ${item.nome}
                          </td>
                          <td>
                             <img src="img/add.png" onclick="location.href='controleprodutos?acao=visualizaProdutoVenda&idV=${item.id}'"/>
                          </td>
                          <td>
                            <img src="img/delete.png" onclick="location.href='controleprodutos?acao=excluiVenda&idV=${item.id}&tipoTabela=${historicoCompras != null ? 'comprador' : 'vendedor' }'"/>
                          </td>
                     </tr>
                 </c:forEach>
		          </tbody>
		      </table>
   </div>
  </body>
</html>